package com.myhexin.demo.ruleengine;

import com.ql.util.express.DefaultContext;
import com.ql.util.express.ExpressRunner;
import lombok.experimental.UtilityClass;

@UtilityClass
public class QLExpressUtil {

    public static void executeAndPrint(ExpressRunner runner, DefaultContext<String, Object> context, String expression, String operation) throws Exception {
        // 执行脚本
        Object result = runner.execute(expression, context, null, true, false);

        // 输出结果
        System.out.println(operation + ": " + result);
    }
}
